@import shared.VarTool
@(missionName: String, missionId: Option[Int])(implicit request: RequestHeader)
@main("重新运行")("reRun") {

	<style>

			.popover {
				max-width: 400px !important;
			}

	</style>

	<div class="page-content">

		<div class="page-bar">
			<ul class="page-breadcrumb">
				<li>
					<i class="fa fa-refresh"></i>
					<a href="#">重新运行</a>
				</li>
			</ul>
		</div>

		<div class="row-fluid">
			<div class="row">
				<div class="col-md-12 col-sm-12">
					<div class="portlet blue-madison box">
						<div class="portlet-title">
							<div class="caption">
								重新运行
							</div>
						</div>

						<div class="portlet-body">

							<form id="form" class=" form-horizontal" accept-charset="UTF-8"
							method="post" style="margin-top: 30px;">

								<input hidden name="hideMissionId" value="@missionId">

								<div class="col-sm-offset-2">
									<span class="error" style="line-height: 35px;">@request.flash.get("info")</span>
								</div>

								<div class="form-group">
									<label class="control-label col-sm-2">任务名: <span class="must">*</span></label>
									<div class="col-sm-4">
										<input class="form-control" name="missionName" value="@missionName" onfocus="inputSelect(this)">
									</div>

								</div>

								<div class="form-group">
									<label class="control-label col-sm-2">数据来自任务: </label>
									<div class="col-sm-4">
										<select name="missionId" id="missionId" class="checkbox form-control" onchange="ReRunMission.missionChange(this)">
											<option></option>
										</select>
									</div>

								</div>

								<div class="form-group" id="colorSolution" style="display: none">
									<label class="control-label col-sm-2">配色方案:</label>
									<div class="col-sm-2">
										<select class="form-control fillByName" style="width: 100%" name="colorSolution">
											<option value="1">方案 1</option>
											<option value="2">方案 2</option>
											<option value="3" selected>方案 3</option>
										</select>
									</div>
								</div>

								<div class="form-group">
									<label class="control-label col-sm-2">代谢物Class库:</label>
									<div class="col-sm-2">
										<select class="form-control select2FillByName" name="dbId" >
										</select>
									</div>
								</div>

								<div>
									<div class="form-group">
										<label class="control-label col-sm-2">物种选择:</label>
										<div class="col-sm-2">
											<select class="form-control" style=""
											id="selectSpecies1" onchange="NewMission.change1(this)">
											</select>
										</div>
										<div class="col-sm-4">
											<select class="form-control" style=""
											name="species" id="species" onchange="NewMission.speciesChange(this)">
											</select>
										</div>
										<div class="col-sm-2">
											<select class="form-control fillByName" style=""
											name="isSmp" >
											</select>
										</div>
									</div>
								</div>

								<div>
									<div class="form-group">
										<label class="control-label col-sm-2">分析数据选择:</label>
										<div class="col-sm-3">
											<select class="form-control fillByName" name="anaKind" >
												<option value="allMet">AllMet</option>
												<option value="allWithRatio">AllMet with ratio</option>
												<option value="onlyRatio">Only ratio</option>
											</select>
										</div>

										<label class="control-label col-sm-2">
											线程数:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="threadNum" id="threadNum" value="4">
										</div>
									</div>
								</div>

								<div id="reportHome">
									<h4 class="">报告首页</h4>
									<div class="form-group">
										<label class="control-label col-sm-2">是否靶向测试:</label>
										<div class="col-sm-3">
											<select class="form-control fillByName" name="reportHome.isTargetTest" >
												<option value="Untargeted Metabolomics Study">
													Untargeted Metabolomics Study</option>
												<option value="Targeted Metabolomics Study">
													Targeted Metabolomics Study</option>
											</select>
										</div>

										<label class="control-label col-sm-2">Client:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="reportHome.client">
										</div>
									</div>

									<div class="form-group">
										<label class="control-label col-sm-2">Affiliation:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="reportHome.affiliation">
										</div>
										<label class="control-label col-sm-2">Project Code:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="reportHome.projectCode">
										</div>

									</div>

									<div class="form-group">

										<label class="control-label col-sm-2">Sales Rep.:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="reportHome.salesRep">
										</div>
										<label class="control-label col-sm-2">Test Order:</label>
										<div class="col-sm-3">
											<select class="form-control" name="testOrder" style="width: 100%"
											onchange="ReRunMission.testOrderChange(this)">
												<option></option>
											</select>
										</div>
									</div>

									<div class="form-group">
										<label class="control-label col-sm-2">Test Order Name:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="reportHome.testOrderName">
										</div>

										<label class="control-label col-sm-2">Test Order ID:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="reportHome.testOrderId">
										</div>
									</div>

									<div class="form-group">
										<label class="control-label col-sm-2">Sample Type:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="reportHome.sampleType">
										</div>
										<label class="control-label col-sm-2">Concentration Unit:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="reportHome.unit">
										</div>
									</div>

								</div>

								<div id="preDeal">
									<h4 class="">预处理参数</h4>
									<div class="form-group">
										<label class="control-label col-sm-2">
											coef<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-content="盖帽法识别并转换异常值的参数，范围在 均值±coef*标准差 之外的数值将会被判定为异常值，并且用附近的均值+/- coef*标准差来替代。默认会将coef设定成一个很大的值（10000），相当于禁用此方法识别和替换异常值。"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="coef" value="10000">
										</div>
									</div>

									<div class="form-group">
										<label class="control-label col-sm-2">
											缺失值处理方式<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
缺失值、0值、字符（NA、“Not avaliable”，“”，“ ”）等会做为缺失值在数据清洗阶段被处理，可选的处理方法有：<br>
1．采用KNN填充来预测缺失值<br>
2．使用所有代谢物最小值的N分之一<br>
3．使用缺失值对应代谢物的最小值的N分之一<br>
4．不进行处理<br>
2、3的思路都是基于假设：该代谢物未检出可能是由于其水平未达到仪器/方法的检出限，因此通过检出的最小值除以1个常数来对这些未到达检出限的代谢物的实际浓度进行预测。因为不同代谢物的检出限可能差别较大，所以推荐采用“方法3”进行缺失值的处理。"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByNameAndTrigger" name="preDeal.replaceMethod" onchange="NewMission.replaceMethodChange(this)">
												<option value="knn" selected>KNN</option>
												<option value="min" >最小值填充—使用所有代谢物的最小值</option>
												<option value="rowMin" >最小值填充—使用对应代谢物的最小值</option>
												<option value="none" >无</option>
											</select>
										</div>
									</div>

									<div class="form-group" id="knn">
										<label class="control-label col-sm-2">knn k值:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="preDeal.knn" value="5">
										</div>
									</div>

									<div class="form-group" id="min" style="display: none">
										<label class="control-label col-sm-2">最小值的N分之一:</label>
										<div class="col-sm-3">
											<input class="form-control fillByName" name="preDeal.min" value="10">
										</div>
									</div>

									<div class="form-group">
										<label class="control-label col-sm-2">
											是否执行LOESS回归校正<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
LOESS（局部加权）回归法利用同一批次检测中，QC样本理论上的响应值应该是稳定不变的这一原理，对数据进行局部加权校正。<br>
因此想要使用LOESS对数据进行校正需要满足两个条件，首先，上传的数据中需要有QC样本（且分组名为“QC”），其次，样本在数据中的排列顺序要与实际的进样顺序一致，校正的结果才有意义。<br>
"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByNameAndTrigger" name="isLoess" onchange="NewMission.loessChange(this)">
												<option value="T" selected>yes</option>
												<option value="F" >no</option>
											</select>
										</div>
										<label class="control-label col-sm-2">
											是否执行归一化<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
											是否按照样本对数据进行总峰面积（或总浓度）归一化。<br>
归一化后的数据，可以理解为该样本中代谢物浓度的所占的比例。
"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByName" name="isNormal" >
												<option value="T">yes</option>
												<option value="F">no</option>
											</select>
										</div>
									</div>

								</div>

								<div id="diff">
									<h4 class="">单变量分析参数(两组)</h4>
									<div class="form-group">
										<label class="control-label col-sm-2">
											分析方法<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
											指定参数/非参数检验，或者采用智能推断法，智能推断法会根据数据的正态性和方差齐性选择对应的参数/非参数检验。
"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByName" name="diffMethod.method" >
												<option value="u">U检验</option>
												<option value="t">T检验</option>
												<option value="auto">智能推断</option>
											</select>
										</div>
										<label class="control-label col-sm-2">
											FC计算方式<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
											指定分析过程中FC值的计算方式：<br>
mean：使用均值/均值计算FC<br>
median：使用中位数/中位数计算FC<br>
智能推断：根据数据的正态性和方差齐性，选择采用均值/均值还是中位数/中位数来计算FC
"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByName" name="diffMethod.fcMethod" >
												<option value="median">Median</option>
												<option value="mean">Mean</option>
												<option value="auto" selected>智能推断</option>
											</select>
										</div>
									</div>

									@user.twoGroup()

								</div>

								<div id="mulDiff">
									<h4 class="">单变量分析参数(多组)</h4>
									<div class="form-group">
										<label class="control-label col-sm-2">
											分析方法<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
											指定参数/非参数检验，或者采用智能推断法，智能推断法会根据数据的正态性和方差齐性选择对应的参数/非参数检验。
"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByName" name="diffMethod.mulMethod" >
												<option value="kw">Kruskal检验</option>
												<option value="anova">Anova检验</option>
												<option value="auto">智能推断</option>
											</select>
										</div>
									</div>
									<div class="form-group">
									@user.mulGroup()
									</div>

								</div>

								<div id="oplsda">
									<h4 class="">OPLSDA参数</h4>

									@user.oplsda()

								</div>

								<div id="merge">
									<h4 class="">差异合并参数</h4>

									<div class="form-group">
										<label class="control-label col-sm-2">
											差异合并<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
											将单维、多维筛选出来的差异代谢物进行整合的方法，可以使用取交集、取并集或者“智能推断（无交取并）”方法，智能推断法会首先取交集，如果发现二者没有交集，就会自动改用并集。
"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByName" name="isInter" >
												<option value="T">交集</option>
												<option value="F">并集</option>
												<option value="auto" selected>智能推断(无交取并)</option>
											</select>
										</div>

									</div>

								</div>

								<div id="biomarker">
									<h4 class="">相关性分析参数</h4>

									<div class="form-group">
										<label class="control-label col-sm-2">
											是否执行自相关分析<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
											是否要对差异代谢物数据内部进行相关分析
"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByNameAndTrigger" name="cor.isSelfCorExec" >
												<option value="T" selected>yes</option>
												<option value="F">no</option>
											</select>
										</div>
									</div>

									<div id="cor">
										<div class="form-group">
											<label class="control-label col-sm-2">
												是否执行相关分析<span id="question5" style="margin-bottom: 5px">
												<a type="button" title="说明" data-container="body" data-toggle="popover"
												data-placement="right" data-html="true" data-content="
											是否要上传其他数据与差异代谢物进行相关分析
"
												data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
											</span>:</label>
											<div class="col-sm-3">
												<select class="form-control fillByName" name="cor.isCorExec" >
													<option value="T">yes</option>
													<option value="F">no</option>
												</select>
											</div>
										</div>

										<div id="parCor">
											<div class="form-group">
												<label class="control-label col-sm-2">
													是否执行偏相关分析<span id="question5" style="margin-bottom: 5px">
													<a type="button" title="说明" data-container="body" data-toggle="popover"
													data-placement="right" data-html="true" data-content="
												是否要上传变量做为控制变量进行偏相关分析。
"
													data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
												</span>:</label>
												<div class="col-sm-3">
													<select class="form-control fillByName" name="cor.isParCorExec" >
														<option value="T">yes</option>
														<option value="F">no</option>
													</select>
												</div>
											</div>
										</div>

									</div>

									@user.cor()

								</div>

								<div id="biomarker">
									<h4 class="">通路分析和富集分析</h4>

									<div class="form-group">
										<label class="control-label col-sm-2">是否执行IPath分析:</label>
										<div class="col-sm-3">
											<select class="form-control fillByName" name="pathway.isIPathExec">
												<option value="T">yes</option>
												<option value="F">no</option>
											</select>
										</div>
									</div>

									<div class="form-group">
										<label class="control-label col-sm-2">是否执行通路富集分析:</label>
										<div class="col-sm-3">
											<select class="form-control fillByNameAndTrigger" name="pathway.isEnrichExec"
											onchange="NewMission.enrichChange(this)">
												<option value="T">yes</option>
												<option value="F">no</option>
											</select>
										</div>
									</div>

									<div id="enrich">
										<div class="form-group">
											<label class="control-label col-sm-2">
												metabolite set library<span id="question5" style="margin-bottom: 5px">
												<a type="button" title="说明" data-container="body" data-toggle="popover"
												data-placement="right" data-html="true" data-content="
													通路富集分析所需要使用的数据库。
"
												data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
											</span>:</label>
											<div class="col-sm-5">
												<select class="form-control" style="" name="pathway.libTypes[]" >
												</select>
											</div>
										</div>
									</div>

									<div class="form-group">
										<label class="control-label col-sm-2">
											是否执行通路拓拓扑分析<span id="question5" style="margin-bottom: 5px">
											<a type="button" title="说明" data-container="body" data-toggle="popover"
											data-placement="right" data-html="true" data-content="
											是否执行通路拓扑分析？<br>
在富集分析的基础之上，通过拓扑学知识，估算了差异代谢物对通路的影响程度。
"
											data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
										</span>:</label>
										<div class="col-sm-3">
											<select class="form-control fillByNameAndTrigger" name="pathway.isPathwayExec" onchange="NewMission.pathwayChange(this)">
												<option value="T">yes</option>
												<option value="F">no</option>
											</select>
										</div>
									</div>

									<div id="pathway">
										<div class="form-group" >
											<label class="control-label col-sm-2">Over Representation Analysis:</label>
											<div class="col-sm-3">
												<select class="form-control fillByName" name="pathway.method" id="db">
													<option value="hyperg">Hypergeometric Test</option>
													<option value="fisher">Fisher's Exact Test</option>
												</select>
											</div>

											<label class="control-label col-sm-2">
												Pathway Topology Analysis<span id="question5" style="margin-bottom: 5px">
												<a type="button" title="说明" data-container="body" data-toggle="popover"
												data-placement="right" data-html="true" data-content="
												通路拓扑分析采用的算法，Out-degree法采用差异代谢物下游代谢物数目来预测对通路的影响，Relative-betweeness利用差异代谢物在通路中涉及的最短代谢路径数来预测对通路的影响。
"
												data-trigger="hover"><i class="fa fa-question-circle-o" ></i></a>
											</span>:</label>
											<div class="col-sm-3">
												<select class="form-control fillByName" name="pathway.nodeImp" id="db">
													<option value="rbc">Relative-betweeness Centrality</option>
													<option value="dgr" selected>Out-degree Centrality</option>
												</select>
											</div>
										</div>
									</div>

									<div>
									</div>

								</div>

								<div id="biomarker">
									<h4 class="">诊断参数</h4>

								</div>

								<div id="diagnose">

								</div>


								<div class="form-group form-horizontal">
									<div class="actions col-sm-offset-2 col-sm-2">
										<button type="button" class="btn btn-primary" style="width: 90%;" id="search" onclick="ReRunMission.myRun">
											开始运行</button>
									</div>
								</div>

							</form>


						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<script>
			$(function () {
				ReRunMission.init
			})

			$(".file").fileinput({

				showPreview: false,
				browseLabel: "选择...",
				removeLabel: "删除文件",
				language: "zh"
			});


	</script>


}
